Communication apparatus, communication system, communication method, program, and integrated circuit

ABSTRACT

A communication apparatus ( 10 ) includes: a measurement data transmitting unit ( 120 ) which transmits a first measurement data to a relay apparatus ( 20 ), and a second measurement data to a partner apparatus ( 30 ); a response data receiving unit ( 130 ) which receives first and second response data; a network measurement unit ( 140 ) which calculates a first communication time using the first response data, and a second communication time using the second response data; a connection mode judging unit ( 150 ) which judges, based on a partner section communication time that is difference between the second and the first communication times, whether or not the relay apparatus ( 20 ) and the partner apparatus ( 30 ) are wirelessly connected; and a connection mode switching unit ( 160 ) which switches, when judged that the relay apparatus ( 20 ) and the partner apparatus ( 30 ) are wirelessly connected, the communication with the partner apparatus ( 30 ) from indirect to direct wireless communication.

TECHNICAL FIELD

The present invention relates to a method of controlling direct linkcommunication in a wireless section. Particularly, the present inventionrelates to a direct link communication control method which judgeswhether or not it is necessary to execute a direct link between thecommunication apparatuses.

BACKGROUND ART

Along with the spread of data communication via network such as theInternet or a LAN, home networking which achieves inter-devicecommunication by connecting home electrical appliances, computers, andother peripheral apparatuses through a network has been widely used inhomes. The home networking enables content transmission and receptionbetween apparatuses connecting to the network, and provides users withconvenience and comfort.

Furthermore, to connect apparatuses one another, networking apparatuseswhich include a function that enables connection through wirelesscommunication is expected to become increasingly widespread in thefuture, from a view point that networking apparatuses have highinstallation flexibility and can eliminate wiring between apparatuses.

For example, an apparatus which includes a receiving unit such as a TVtuner and a storing unit such as a hard disk can be installed in a homeas a server apparatus. Then, contents such as a movie held in the serverapparatus is transmitted to a client apparatus such as a digital TV anda PC via a home network. With this, the client apparatus can reproducethe contents while receiving data, and thus so-called content datastream distribution and reproduction processing is performed.

In the case of content data stream distribution between the serverapparatus and the client apparatus that are connected through wirelessconnection, lack of communication bandwidth occurs due tocharacteristics of the wireless communication, when a distance betweendevices is long or depending on the environment where the device isinstalled. Consequently, a problem such as delay in streaming datadistribution occurs.

To address this problem, for example, Patent Literature (PTL) 1 proposesa method for judging whether or not a wireless section exists betweenthe server apparatus and the client apparatus, and transmitting dataefficiently adapted for the wireless section.

FIG. 6 is a functional block diagram showing a transmitting apparatusincluded in a communication control apparatus according to aconventional example of the present invention. The transmittingapparatus shown in FIG. 6 calculates bandwidth using two packets havingmutually different length. Specifically, the transmitting apparatusincludes: a network bandwidth calculation unit 401 which calculates anetwork bandwidth by dividing a total amount of data, which is receivedby a receiving side, by the time taken for the reception; and a wirelesssection estimation unit 402 which estimates whether or not a wirelesssection as a wireless transmission path exists in a network throughwhich data is to be transmitted, by comparing a network bandwidth at thetime of a first packet size and a network bandwidth at the time of asecond packet size that have been calculated by the network bandwidthcalculation unit 401.

That is, in the case of a wireless LAN compliant with IEEE 802.11, atransmission waiting time and an ACK for delivery confirmation are addedto each of data packets to be transmitted. Accordingly, for example,when it is assumed that 1500-byte data is transmitted, there is a largedifference in throughout when five packets each containing a 300-byteare transmitted, compared to a case where one packet containing a1500-byte is transmitted. This is because the transmission waiting timetakes five times as long and waiting time for ACK response takes fivetimes as long. Due to this, when the difference in the networkbandwidths calculated using the packets of two different sizes is equalto or larger than a predetermined threshold value, it is possible tojudge that there is a wireless section.

When a wired LAN is used, the transmission waiting time is significantlyshort compared to the transmission waiting time of the wireless LAN.Also, there is no ACK response for delivery confirmation. Thus, when thedifference in packet size is as much as about the difference between the300-byte and the 1500-byte, a large difference in a communication timethat is observed when the wireless LAN is used is not observed. In otherwords, a decrease in transmission throughput does not occur. Thus,taking advantage of the above described characteristics, it is possibleto estimate that there is a wireless section in a certain section of anetwork through which data is to be transmitted, when a differencebetween the network bandwidth measured with the packet containing1500-byte and a network bandwidth measured with the packets eachcontaining 300-byte is, for example, 50% or more of the networkbandwidth measured with a packet containing 1500-byte.

Estimation of the wireless section as described above allows efficientdata transmission adapted for wireless sections. For example, data to betransmitted is coded such that the data has error tolerance, or, aplurality of frame data to be transmitted is packetized into one packet.

CITATION LIST Patent Literature [PTL 1]

Japanese Unexamined Patent Application No. 2005-286751

SUMMARY OF INVENTION Technical Problem

It is possible to improve the deteriorated performance relating to thestreaming data distribution of video contents by judging that there is awireless section between the server apparatus and the client apparatusin the home network, and transmitting data efficiently adapted for awireless section as described above.

However, the above described conventional method can only estimate theconnection state of two apparatuses that are directly connected to eachother. In other words, when a transmitting apparatus and a receivingapparatus are connected via a relay apparatus such as a router, thetransmitting apparatus can estimate the connection state between thetransmitting apparatus and the relay apparatus through, the transmittingapparatus cannot recognize the connection state between the relayapparatus and the receiving apparatus.

The present invention is conceived in view of the above-mentionedproblem, and has an object of providing a communication apparatus, acommunication system, and a communication method which can recognize aconnection state of a partner apparatus and select an appropriateconnection mode, when the transmitting apparatus is communicating with apartner apparatus that is connected to a relay apparatus. The presentinvention has another object of providing a program and an integratedcircuit which can implement the apparatus, the system and the methoddescribed above.

Solution to Problem

A communication apparatus according to an aspect of the presentinvention is a communication apparatus which is connected throughwireless connection to a relay apparatus that relays data, andcommunicates with a partner apparatus connected to the relay apparatus.More specifically, the communication apparatus includes: a measurementdata transmitting unit configured to transmit (i) first measurement datato the relay apparatus, and (ii) second measurement data to the partnerapparatus via the relay apparatus, the first measurement data being datafor measuring a communication time between the communication apparatusand the relay apparatus, and the second measurement data being data formeasuring a communication time between the communication apparatus andthe partner apparatus via the relay apparatus; a response data receivingunit configured to (i) receive, from the relay apparatus, first responsedata that is a response to the first measurement data, and (ii) receive,from the partner apparatus via the relay apparatus, second response datathat is a response to the second measurement data; a network measurementunit configured to (i) calculate, based on the first response data, afirst communication time that is a communication time between thecommunication apparatus and the relay apparatus, and (ii) calculate,based on the second response data, a second communication time that is acommunication time between the communication apparatus and the partnerapparatus via the relay apparatus; a connection mode judging unitconfigured to judge whether or not the relay apparatus and the partnerapparatus are connected through wireless connection, based on a partnersection communication time that is a difference between the secondcommunication time and the first communication time; and a connectionmode switching unit configured to switch, when the connection modejudging unit judges that the relay apparatus and the partner apparatusare connected through wireless connection, the communication with thepartner apparatus from indirect wireless communication to directwireless communication, the indirect wireless communication beingwireless communication via the relay apparatus, and the direct wirelesscommunication being wireless communication not via the relay apparatus.

With the communication apparatus having the above structure, it ispossible to judge the connection mode of the partner section (betweenthe relay apparatus and the partner apparatus) by measuring the firstcommunication time, which is a communication time between thecommunication apparatus and the relay apparatus, and the secondcommunication time, which is a communication time between thecommunication apparatus and the partner apparatus via the relayapparatus. As a result, it is possible to provide the communicationapparatus which can appropriately select a communication mode (indirectwireless communication or direct wireless communication) forcommunication with the partner apparatus by recognizing the connectionmode (wired or wireless) of the partner section.

Furthermore, the connection mode judging unit may be configured to judgethat the relay apparatus and the partner apparatus are connected throughwireless connection, when the partner section communication time is 50%or more of the first communication time. When the communicationapparatus and the relay apparatus are connected through wirelessconnection, and the relay apparatus and the destination apparatus arealso connected through wireless connection, in theory, the communicationtime between the communication apparatus and the relay apparatus, andthe communication time between the relay apparatus and the destinationapparatus are equivalent (destination section communication time z firstcommunication time). However, the communication time of the wirelesscommunication varies depending on a distance between the apparatuses ora location of installation. Thus, it is preferable to adopt the abovedescribed threshold value.

In addition, the connection mode judging unit is configured to hold, inadvance, an assumed communication time that is a partner sectioncommunication time assumed when the relay apparatus and the partnerapparatus are connected through wired connection. When the partnersection communication time falls outside the assumed communication time,the connection mode judging unit may judge that the relay apparatus andthe partner apparatus are connected through wireless connection. Thecommunication time is more stable in the wired communication than inwireless communication. Thus, the communication time in wiredcommunication can be assumed in advance. Then, as described above, itmay be judged that the partner section is connected through wirelessconnection, when the partner section communication time does not fallwithin the assumed communication time that is assumed in advance.

Furthermore, the measurement data transmitting unit may be configured tosequentially transmit (i) a plurality of measurement packets which areincluded in the first measurement data, and (ii) a plurality ofmeasurement packets which are included in the second measurement data.On the other hand, the response data receiving unit may be configured tosequentially receive (i) a plurality of response packets which areincluded in the first response data, and (ii) a plurality of responsepackets which are included in the second response data. When themeasurement data and response data are transmitted and received afterbeing divided into a plurality of packets, an overhead that isparticular to the wireless communication (a header, a transmissionwaiting time, ACK and the like) becomes more apparent. As a result, theconnection mode can be judged more accurately.

A communication system according to an another aspect of the presentinvention is a system includes: a relay apparatus that relays data; apartner apparatus connected to the relay apparatus; and a communicationapparatus that is connected through wireless connection to the relayapparatus and communicates with the partner apparatus. The communicationapparatus includes: a measurement data transmitting unit configured totransmit (i) a first measurement data to the relay apparatus, and (ii) asecond measurement data to the partner apparatus via the relayapparatus, the first measurement data being data for measuring acommunication time between the communication apparatus and the relayapparatus, and the second measurement data being data for measuring acommunication time between the communication apparatus and the partnerapparatus via the relay apparatus; a response data receiving unitconfigured to (i) receive, from the relay apparatus, first response datathat is a response to the first measurement data, and (ii) receive, fromthe partner apparatus via the relay apparatus, second response data thatis a response to the second measurement data; a network measurement unitconfigured to (i) calculate, based on the first response data, a firstcommunication time that is a communication time between thecommunication apparatus and the relay apparatus, and (ii) calculate,based on the second response data, a second communication time that is acommunication time between the communication apparatus and the partnerapparatus via the relay apparatus; a connection mode judging unitconfigured to judge whether or not the relay apparatus and the partnerapparatus are connected through wireless connection, based on a partnersection communication time that is a difference between the secondcommunication time and the first communication time; and a connectionmode switching unit configured to switch, when the connection modejudging unit judges that the relay apparatus and the partner apparatusare connected through wireless connection, the communication with thepartner apparatus from indirect wireless communication to directwireless communication, indirect wireless communication being wirelesscommunication via the relay apparatus, and the direct- wirelesscommunication being wireless communication not via the relay apparatus.The relay apparatus includes: a data transmitting and receiving unitconfigured to generate the first response data based on the firstmeasurement data, and to transmit the generated first response data tothe communication apparatus; and a data relay unit configured to relaythe second measurement data received from the communication apparatus tothe partner apparatus, and to relay the second response data receivedfrom the partner apparatus to the communication apparatus. The partnerapparatus includes a data transmitting and receiving unit configured togenerate the second response data based on the second measurement data,and to transmit the generated second response data to the communicationapparatus via the relay apparatus, the second measurement data beingreceived from the partner apparatus via the relay apparatus.

A communication method according to yet another aspect of the presentinvention is a method for causing a communication apparatus to switchbetween connection modes for communication with a partner apparatus, thecommunication apparatus being connected through wireless connection to arelay apparatus that relays data and communicating with the partnerapparatus that is connected to the relay apparatus. More specifically,the communication method includes: transmitting (i) first measurementdata to the relay apparatus, and (ii) second measurement data to thepartner apparatus via the relay apparatus, the first measurement databeing data for measuring a communication time between the communicationapparatus and the relay apparatus, and the second measurement data beingdata for measuring a communication time between the communicationapparatus and the partner apparatus via the relay apparatus; (i)receiving, from the relay apparatus, first response data that is aresponse to the first measurement data, and (ii) receiving, from thepartner apparatus via the relay apparatus, second response data that isa response to the second measurement data; calculating (i) a firstcommunication time based on the first response data, and (ii) a secondcommunication time based on the second response data, the firstcommunication time being a communication time between the communicationapparatus and the relay apparatus, and the second communication timebeing a communication time between the communication apparatus and thepartner apparatus via the relay apparatus; judging whether or not therelay apparatus and the partner apparatus are connected through wirelessconnection, based on a partner section communication time that is adifference between the second communication time and the firstcommunication time; and switching, when it is judged in the judging thatthe relay apparatus and the partner apparatus are connected throughwireless connection, the communication with the partner apparatus fromindirect wireless communication to direct wireless communication, theindirect wireless communication being wireless communication via therelay apparatus, and the direct wireless communication being wirelesscommunication not via the relay apparatus.

A program according to yet another aspect of the present inventioncauses a communication apparatus to switch between connection modes forcommunication with a partner apparatus, the communication apparatusbeing connected through wireless connection to a relay apparatus thatrelays data and communicating with the partner apparatus that isconnected to the relay apparatus. More specifically, the program causesthe communication apparatus to execute: transmitting (i) a firstmeasurement data to the relay apparatus, and (ii) a second measurementdata to the partner apparatus via the relay apparatus, the firstmeasurement data being data for measuring a communication time betweenthe communication apparatus and the relay apparatus, and the secondmeasurement data being data for measuring a communication time betweenthe communication apparatus and the partner apparatus via the relayapparatus; (i) receiving, from the relay apparatus, first response datathat is a response to the first measurement data, and (ii) receiving,from the partner apparatus via the relay apparatus, second response datathat is a response to the second measurement data; calculating (i) afirst communication time based on the first response data, and (ii) asecond communication time based on the second response data, the firstcommunication time being a communication time between the communicationapparatus and the relay apparatus, and the second communication timebeing a communication time between the communication apparatus and thepartner apparatus via the relay apparatus; judging whether or not therelay apparatus and the partner apparatus are connected through wirelessconnection, based on a partner section communication time that is adifference between the second communication time and the firstcommunication time; and switching, when it is judged in the judging thatthe relay apparatus and the partner apparatus are connected throughwireless connection, the communication with the partner apparatus fromindirect wireless communication to direct wireless communication, theindirect wireless communication being wireless communication via therelay apparatus, and the direct wireless communication being wirelesscommunication not via the relay apparatus.

An integrated circuit according to yet another aspect of the presentinvention is an integrated circuit for causing a communication apparatusto switch between connection modes for communication with a partnerapparatus, the communication apparatus being connected through wirelessconnection to a relay apparatus that relays data and communicating withthe partner apparatus that is connected to the relay apparatus. Morespecifically, the integrated circuit includes: a measurement datatransmitting unit configured to transmit (i) a first measurement data tothe relay apparatus, and (ii) a second measurement data to the partnerapparatus via the relay apparatus, the first measurement data being datafor measuring a communication time between the communication apparatusand the relay apparatus, and the second measurement data being data formeasuring a communication time between the communication apparatus andthe partner apparatus via the relay apparatus; a response data receivingunit configured to (i) receive, from the relay apparatus, first responsedata that is a response to the first measurement data, and (ii) receive,from the partner apparatus via the relay apparatus, second response datathat is a response to the second measurement data; a network measurementunit configured to (i) calculate, based on the first response data, afirst communication time that is a communication time between thecommunication apparatus and the relay apparatus, and (ii) calculate,based on the second response data, a second communication time that is acommunication time between the communication apparatus and the partnerapparatus via the relay apparatus; a connection mode judging unitconfigured to judge whether or not the relay apparatus and the partnerapparatus are connected through wireless connection, based on a partnersection communication time that is a difference between the secondcommunication time and the first communication time; and a connectionmode switching unit configured to switch, when the connection modejudging unit judges that the relay apparatus and the partner apparatusare connected through wireless connection, the communication with thepartner apparatus from indirect wireless communication to directwireless communication, the indirect wireless communication beingwireless communication via the relay apparatus, and the direct wirelesscommunication being wireless communication not via the relay apparatus.

It is to be noted that the present invention may be realized not only asthe communication apparatus but also as an integrated circuit whichachieves functions of the communication apparatus, and as a programwhich causes a computer to perform such functions. And it goes withoutsaying that such a program can be distributed through recording mediasuch as a CD-ROM and transmission media such as the Internet.

Advantageous Effects of Invention

With the communication apparatus having the above structure, it ispossible to judge the connection mode of the partner section (betweenthe relay apparatus and the partner apparatus) by measuring the firstcommunication time, which is a communication time between thecommunication apparatus and the relay apparatus, and the secondcommunication time, which is a communication time between thecommunication apparatus and the partner apparatus via the relayapparatus. As a result, it is possible to provide the communicationapparatus which can appropriately select a communication mode (indirectwireless communication or direct wireless communication) forcommunication with the partner apparatus by recognizing the connectionmode (wired or wireless) of the partner section.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a diagram showing a system structure and a functional block ofeach of components of a communication system according to an embodimentof the present invention.

FIG. 2 is a flowchart illustrating an operation performed by acommunication apparatus according to an embodiment of the presentinvention.

FIG. 3 is a diagram showing a flow of data, when measurement data istransmitted between the communication apparatus and a relay apparatusthat are connected through wireless connection.

FIG. 4 is a diagram showing a flow of data, when measurement data istransmitted between the relay apparatus and a partner apparatus that areconnected through wired connection.

FIG. 5 is a diagram showing an example of a judging criterion forjudging a connection mode of a partner section.

FIG. 6 is a functional block diagram of a conventional communicationapparatus.

DESCRIPTION OF EMBODIMENT

FIG. 1 is a diagram showing a system structure of a communication system1 according to an embodiment of the present invention. The communicationsystem 1 includes: a communication apparatus 10 according to anembodiment of the present invention; a relay apparatus 20 that relaysdata; and a partner apparatus 30 that communicates with thecommunication apparatus 10 via the relay apparatus 20. It is to be notedthat the communication apparatus 10 and the relay apparatus 20 areconnected through wireless connection. On the other hand, the relayapparatus 20 and the partner apparatus 30 may be connected through wiredconnection or through wireless connection. Further, it is assumed thatthe communication apparatus 10 and the relay apparatus 20 are connecteddirectly, that is, there is no device between the communicationapparatus 10 and the relay apparatus 20. Also, it is assumed that therelay apparatus 20 and the partner apparatus 30 are connected directly,that is, there is no device between the relay apparatus 20 and thepartner apparatus 30.

It is to be noted that a typical example of the relay apparatus 20 is arouter. Meanwhile, typical examples of the communication apparatus 10and the partner apparatus 30 are Personal Computers (PCs).Alternatively, the communication apparatus 10 may also be a DVD recorderor a content server which includes a receiving unit such as a TV tunerand a storing unit such as a hard disk; and the partner apparatus 30 mayalso be a TV or the like that receives contents from the communicationapparatus 10 through a home network and reproduces the receivedcontents.

The communication apparatus 10 includes: a communication InterFace (I/F)110; a measurement data transmitting unit 120; a response data receivingunit 130; a network measurement unit 140; a connection mode judging unit150; and a connection mode switching unit 160.

The communication I/F 110 is a wireless communication interface whichperforms wireless communication in a manner specified by IEEE 802.11,and is connected to the relay apparatus 20 through wireless connection.The communication I/F 110 supports both indirect wireless communication(infrastructure mode) that is wireless communication via the relayapparatus 20, and direct wireless communication (Direct Link Setup) thatis wireless communication not via the relay apparatus 20.

The measurement data transmitting unit 120 transmits measurement datafor measuring a communication time between the communication apparatus10 and an other device. The measurement data transmitting unit 120 inthis embodiment transmits a first measurement data, which is formeasuring a communication time between the communication apparatus 10and the relay apparatus 20, and a second measurement data, which is formeasuring a communication time between the communication apparatus 10and the partner apparatus 30. Here, “communication time between thecommunication apparatus 10 and the partner apparatus 30” refers to thetime required for communication between the communication apparatus 10and the partner apparatus 30 via the relay apparatus 20. In other words,the second measurement data is delivered to the partner apparatus 30 viathe relay apparatus 20.

It is to be noted that, for the measurement of a communication time,“PING command” or the like can be used. Specifically, the communicationtime can be measured by inputting, in a command interface, “ping −1measurement_data_size_address_of_target_apparatus”.

That is, the measurement data is an “echo request” specified by InternetControl Message Protocol (ICMP). Likewise, response data is an “echoreply”.

The response data receiving unit 130 receives, from the relay apparatus20, first response data, which is a response to the first measurementdata, and second response data, which is a response to the secondmeasurement data. It is to be noted that the second response data isdelivered from the partner apparatus 30 to the communication apparatus10 via the relay apparatus. 20 in the similar manner as for the secondmeasurement data.

The network measurement unit 140 calculates, from the first responsedata, a first communication time that is a communication time betweenthe communication apparatus 10 and the relay apparatus 20. In thesimilar manner, the network measurement unit 140 calculates, from thesecond response data, a second communication time that is acommunication time between the communication apparatus 10 and thepartner apparatus 30. Further, the network measurement unit 140calculates a partner section communication time that is a differencebetween the second communication time and the first communication time.

The connection mode judging unit 150 judges, based on the partnersection communication time, whether the relay apparatus 20 and thepartner apparatus 30 are connected through wired connection or throughwireless connection. For example, following criteria can be adopted forthe judgment. It is possible to judge that the relay apparatus 20 andthe partner apparatus 30 are connected through wireless communicationwhen the partner section communication time is the same as or longerthan the first communication time, that is, when the communication timebetween the relay apparatus 20 and the partner apparatus 30 (the partnersection communication time) is the same as or longer than thecommunication time between the communication apparatus 10 and the relayapparatus 20 (the first communication time).

The connection mode switching unit 160 switches, when it is judged bythe connection mode judging unit 150 that the relay apparatus 20 and thepartner apparatus 30 are connected through wireless connection, thecommunication with the partner apparatus 30 from indirect wirelesscommunication to direct wireless communication.

Specifically, the connection mode switching unit 160 transmits a requestfor connection (DLSRequest) to the partner apparatus 30 via the relayapparatus 20. Receiving the DLSRequest, the partner apparatus 30transmits a response (DLSResponse) to the communication apparatus 10 viathe relay apparatus 20, when the partner apparatus 30 itself is equippedwith a function for a DLS. This completes the setting for the DLSbetween the communication apparatus 10 and the partner apparatus 30.When the DLS setting is completed, the communication apparatus 10 andthe partner apparatus 30 can communicate data directly (through the pathindicated by a broken line in FIG. 1).

It is to be noted that the measurement data transmitting unit 120according to this embodiment divides the measurement data into aplurality of measurement packets, and sequentially transmits themeasurement packets. On the other hand, the response data receiving unit130 according to this embodiment sequentially receives a plurality ofresponse packets, and obtains response data by combining the responsepackets. Furthermore, the network measurement unit 140 measures, as thecommunication time, the time taken from start of transmission of thefirst measurement packet to the completion of receiving of the lastresponse packet.

The relay apparatus 20 is an apparatus that receives data, and relaysthe received data according to a destination address. Specifically, therelay apparatus 20 includes communication I/Fs, which are acommunication I/F 210 and a communication I/F 220, a data relay unit230, and a data transmitting and receiving unit 240. The communicationI/F 210 is a wireless communication interface which is connected to thecommunication I/F 110 of the communication apparatus 10. Thecommunication I/F 220 is an interface that is connected to the partnerapparatus 30.

A data relay unit 230 relays data based on the destination address thatis set in a header of the received data. Specifically, when the addressof the relay apparatus 20 itself is set in the data received through thecommunication I/Fs 210 and 220, the data relay unit 230 notifies thedata transmitting and receiving unit 240 of the data. Furthermore, whenthe data relay unit 230 is notified of data by the data transmitting andreceiving unit 240, the data relay unit 230 transmits the notified datathrough the appropriate communication I/F 210 or 220 based on thedestination address. On the other hand, when an address of an otherapparatus is set in the data received through the communication I/Fs 210and 220, the data relay unit 230 transmits the received data through theappropriate communication I/F 210 or 220 without notifying the datatransmitting and receiving unit 240.

The data transmitting and receiving unit 240 generates the firstresponse data in response to the first measurement data received fromthe communication apparatus 10, and transmits the first response data tothe communication apparatus 10 through the communication I/F 210.

The partner apparatus 30 includes a communication I/F 310 and a datatransmitting and receiving unit 320. The communication I/F 310 is aninterface which is connected to the communication I/F 220 of the relayapparatus 20. Connection mode is either wired connection or wirelessconnection. The data transmitting and receiving unit 320 generates thesecond response data in response to the second measurement data which isreceived from the communication apparatus 10 via the relay apparatus 20,and transmits the second response data to the communication apparatus 10via the relay apparatus 20.

Following describes a flow of the measurement data and the response dataaccording to the communication system 1 having the above describedstructure.

First, the measurement data transmitting unit 120 in the communicationapparatus 10 transmits, to the relay apparatus 20, the first measurementdata in which an address of the relay apparatus 20 (communication I/F210) is set in the destination address field. The data relay unit 230 inthe relay apparatus 20 confirms that the address of the relay apparatus20 itself is set in the destination address field of the firstmeasurement data which is received through the communication I/F 210,and notifies the data transmitting and receiving unit 240. The datatransmitting and receiving unit 240 generates the first response data inresponse to the first measurement data, and transmits the first responsedata to the communication apparatus 10 through the communication I/F 210after setting in the destination address field an address of thecommunication apparatus 10.

Furthermore, the measurement data transmitting unit 120 in thecommunication apparatus 10 transmits, to the relay apparatus 20, thesecond measurement data in which an address of the partner apparatus 30is set in the destination address field. The data relay unit 230 in therelay apparatus 20 confirms that an address of the partner apparatus 30is set in the destination address field of the second measurement datareceived through the communication I/F 210, and then transmits thesecond measurement data to the partner apparatus 30 through thecommunication I/F 220. The data transmitting and receiving unit 320 inthe partner apparatus 30 generates the second response data in responseto the received second measurement data, and transmits the secondresponse data to the relay apparatus 20 after storing in the destinationaddress field an address of the communication apparatus 10. The datarelay unit 230 in the relay apparatus 20 transmits the second responsedata, which is received through the communication I/F 220, to thecommunication apparatus 10 through the communication I/F 210.

Next, with reference to FIG. 2 to FIG. 4, processing performed by thecommunication apparatus 10 to judge the connection mode between therelay apparatus 20 and the partner apparatus 30 is described. It is tobe noted that FIG. 2 is a flowchart illustrating the operation of thecommunication apparatus 10. FIG. 3 shows a flow of data, when themeasurement data is communicated between the communication apparatus 10and the relay apparatus 20 that are connected through wirelessconnection. FIG. 4 is a diagram showing a flow of data, when themeasurement data is communicated between the relay apparatus 20 and thepartner apparatus 30 that are connected through wired connection.

It is to be noted that the size of the first and the second measurementdata according to this embodiment is 10500 bytes. With Ethernet® or awireless LAN, the measurement data is divided into 1500-byte measurementpackets and then transmitted. Thus, it is assumed that seven measurementpackets (1500-byte) are communicated in this embodiment. Also note thatthe size of the measurement data and the response data are the same.

First, the communication apparatus 10 executes measurement processing ofa first communication time (S11). In other words, the measurement datatransmitting unit 120 transmits the first measurement data to the relayapparatus 20; and the response data receiving unit 130 receives thefirst response data, which is a response to the first measurement data,from the relay apparatus 20. Then, the network measurement unit 140calculates the first communication time.

Specifically, the measurement data transmitting unit 120 in thecommunication apparatus 10 waits for duration of Distributed InterFrameSpace (DIFS) as shown in FIG. 3, and then transmits a measurement packet(1) to the relay apparatus 20. On the other hand, the communication I/F210 in the relay apparatus 20 waits for duration of Short InterFrameSpace (SIFS) when the reception of the measurement packet (1) describedabove is completed, and then transmits, to the communication apparatus10, an ACKnowledgement (ACK) packet that indicates the completion ofreception of the data.

Here, as shown in FIG. 3, the 1500-byte measurement packet (1) is addedwith 18-byte Physical Layer Convergence Protocol (PLCP) preamble, 4-bytePLCP header, 34-byte wireless communication header, and 4-byte FrameCheck Sequence (FCS). This means that the measurement data transmittingunit 120 transmits a total of 1570-byte data.

In other words, when it is assumed that the data transfer rate betweenthe communication apparatus 10 and the relay apparatus 20 is 54 MegaBits Per Second (Mbps), it takes approximately 222 (μsec) to transmitthe 1570-byte data, and it takes approximately 24 (μsec) to transmit theACK packet. Furthermore, the DIFS is 101.5 (μsec) and the SIFS is 16(μsec). Accordingly, it takes approximately 363.5 (μsec) from when thecommunication apparatus 10 starts the transmission of the measurementpacket (1) to when the communication apparatus 10 completes thereception of the ACK packet.

In this embodiment, the communication apparatus 10 transmits sevenmeasurement packets (1) to (7) according to the procedure describedabove. Thus, it takes approximately 2544.5 (μsec) until the relayapparatus 20 completes the reception of the first measurement data.Furthermore, processing of transmitting and receiving of the firstresponse packet is similar to the above. Thus, it takes approximately5.089 (msec) from when the communication apparatus 10 starts thetransmission of the first measurement data to when the communicationapparatus 10 completes the reception of the first response data. Inother words, the first communication time calculated by the networkmeasurement unit 140 is 5.089 (msec).

Next, the communication apparatus 10 executes measurement processing ofthe second communication time (S12). In other words, the measurementdata transmitting unit 120 transmits the second measurement data to thepartner apparatus 30 via the relay apparatus 20. Then, the response datareceiving unit 130 receives the second response data, which is aresponse to the second measurement data, from the partner apparatus 30via the relay apparatus 20. Then, the network measurement unit 140calculates the second communication time.

At this time, a time taken to transmit the second measurement data fromthe communication apparatus 10 to the relay apparatus 20, and a timetaken to transmit the second response data from the relay apparatus 20to the communication apparatus 10 are similar to the above description.Thus, the description thereof is omitted. Furthermore, when the relayapparatus 20 and the partner apparatus 30 are connected through wirelessconnection, a time taken to transmit the second measurement data fromthe relay apparatus 20 to the partner apparatus 30, and a time taken totransmit the second response data from the partner apparatus 30 to therelay apparatus 20 are also similar to the above description. In otherwords, when the relay apparatus 20 and the partner apparatus 30 areconnected through wireless connection, the second communication timecalculated by the network measurement unit 140 is 10.178 (msec).

On the other hand, when the relay apparatus 20 and the partner apparatus30 are connected through wired connection, transmitting and receiving ofdata between the relay apparatus 20 and the partner apparatus 30 areperformed in a quite different manner than FIG. 3. Specifically, asshown in FIG. 4, the data relay unit 230 in the relay apparatus 20 waitsfor a predetermined transmission waiting time, and then transmits themeasurement packet (1) to the partner apparatus 30. Here, as shown inFIG. 4, the 1500-byte measurement packet (1) is added with a 34-bytewired communication header, and 4-byte Frame Check Sequence (FCS). Thus,the data relay unit 230 transmits a total of 1538-byte data. When datais transmitted through wired connection, the ACK packet which indicatesthe completion of the reception of data is not necessary.

To put it differently, when it is assumed that the data transfer ratebetween the relay apparatus 20 and the partner apparatus 30 isequivalent to the case shown in FIG. 3 (54 Mbps), it takes approximately217 (μsec) to transmit the 1538-byte data. In addition, when data istransmitted through wired connection, the transmission waiting time issignificantly short compared to the transmission time of data. Thus, thetransmission waiting time can be ignored. As a result, it takesapproximately 1.52 (msec) from when the relay apparatus 20 starts thetransmission of the measurement packet (1) to when the partner apparatus30 completes the reception of the measurement packet (7). Furthermore,it takes an equivalent amount of time as the time described above totransmit the second response data from the partner apparatus 30 to therelay apparatus 20. Thus, it takes approximately 3.04 (msec) from whenthe relay apparatus 20 starts the transmission of the second measurementdata to when the relay apparatus 20 completes the reception of thesecond response data.

Accordingly, the time required from when the communication apparatus 10starts the transmission of the second measurement data to when thecommunication apparatus 10 completes the reception of the secondresponse data is determined as 8.129 (msec) by adding the communicationtime between the communication apparatus 10 and the relay apparatus 20,which is 5.089 (msec), and the communication time between the relayapparatus 20 and the partner apparatus 30, which is 3.04 (msec). Inother words, the second communication time calculated by the networkmeasurement unit 140 is 8.129 (msec).

It is to be noted that the measurement processing of the firstcommunication time (S11) and the measurement processing of the secondcommunication time (S12) may be performed in reverse order or may beperformed in parallel.

Next, the network measurement unit 140 in the communication apparatus 10calculates a partner section communication time based on the first andthe second communication time (S13). The partner section communicationtime refers to a time required for communication between the relayapparatus 20 and the partner apparatus 30, and is obtained bycalculating the difference between the second communication time and thefirst communication time.

In this embodiment, the partner section communication time is, when therelay apparatus 20 and the partner apparatus 30 are connected throughwireless connection, 5.089 (msec). On the other hand, when the relayapparatus 20 and the partner apparatus 30 are connected through wiredconnection, the partner section communication time is 3.04 (msec).However, in practice, a certain amount of time is required for internalprocessing performed by the relay apparatus 20. Thus, the actual partnersection communication time takes about several (μsec) to several dozen(μsec) longer than the time described above.

Next, the connection mode judging unit 150 in the communicationapparatus 10 judges, based on the partner section communication time,whether or not the partner section, that is, whether or not the relayapparatus 20 and the partner apparatus 30 are connected through wirelessconnection (S14). Specifically, when the partner section communicationtime is the same as or longer than the first communication time, theconnection mode judging unit 150 judges that the partner section iswireless section (Yes in S14). When the partner section communicationtime is shorter than the first communication time, the connection modejudging unit 150 judges that the partner section is wired section (No inS14).

When it is judged that the relay apparatus 20 and the partner apparatus30 are connected through wireless connection (Yes in S14), theconnection mode switching unit 160 in the communication apparatus 10switches the communication with the partner apparatus 30 from indirectwireless communication to direct wireless communication (S15).Specifically, the communication apparatus 10 and the partner apparatus30 can start the direct wireless communication (direct linkcommunication) by transmitting and receiving a request for connection(DLSRequest) and a response (DLSResponse) via the relay apparatus 20.

On the other hand, when it is judged by the connection mode judging unit150 that the relay apparatus 20 and the partner apparatus 30 areconnected through wired connection (No in S14), the communication methodbetween the apparatus 10 and the partner apparatus 30 is not changed,and data is communicated via the relay apparatus 20.

With the communication apparatus 10 having the above describedstructure, it is possible to judge the connection mode of the partnersection (the section between the relay apparatus 20 and the partnerapparatus 30) by measuring the first communication time, which is thecommunication time between the communication apparatus 10 and the relayapparatus 20, and the second communication time, which is thecommunication time between the communication apparatus 10 and thepartner apparatus 30 via the relay apparatus 20. As a result, it ispossible to obtain the communication apparatus 10 which canappropriately select a communication mode (indirect wirelesscommunication or direct wireless communication) to be used between thecommunication apparatus 10 and the partner apparatus 30 by recognizingthe connection mode (wired or wireless) of the partner section.

Furthermore, the first and the second communication time can be measuredusing a PING command. Thus, it is not necessary to change an existingfunction of or to add new function to the relay apparatus 20 and thepartner apparatus 30. Therefore, the processing described above can beperformed without changing an existing system substantially.

Furthermore, compared to the wired communication shown in FIG. 4, thewireless communication shown in FIG. 3 has a larger overhead such as theheader that is added to each of packets, the ACK packet for notifyingthe completion of receiving, and the long transmission waiting time.Thus, difference in a communication time becomes more apparent as themeasurement data and response data are transmitted and received afterbeing divided into a plurality of packets. As a result, the connectionmode can be judged more accurately.

Further, when apparatuses which support the DLS are connected directlythrough wireless connection, a load on the relay apparatus 20 islessened. Thus, communication delay or the like on other apparatusesconnected to the relay apparatus 20 can be suppressed. As a result, thecommunication system 1 which has high throughput can be obtained.

It is to be noted that although, in the example according to anembodiment describe above, it is judged that the partner section isconnected through wireless connection when the partner sectioncommunication time is the same as or longer than the first communicationtime, the present invention is not limited to the above, and otherjudging criteria may be adopted.

For example, a communication time in wireless communication depends on aphysical distance between apparatuses. In other words, the abovedescribed judging criterion is based on a premise that the distancebetween the communication apparatus 10 and the relay apparatus 20, andthe distance between the relay apparatus 20 and the partner apparatus 30are equivalent. To put it differently, when the distance between thecommunication apparatus 10 and the relay apparatus 20 is longer than thedistance between the relay apparatus 20 and the partner apparatus 30,there is a possibility that the partner section communication timebecomes shorter than the first communication time even when the relayapparatus 20 and the partner apparatus 30 are connected through wirelessconnection.

Thus, it is preferable to consider the above described matter whensetting a threshold of the judging criteria. Specifically, as describedlater, the partner section communication time is 1.64 msec(approximately 32% of the first communication time) when the relayapparatus 20 and the partner apparatus 30 are connected through wiredconnection and a data transfer rate is 100 Mbps. Thus, the partnersection communication time needs to be 32% or more of the firstcommunication time. In view of this, the connection mode judging unit150 may judge that the partner section is connected through wirelessconnection, when the partner section communication time is at least 50%or 60% of the first communication time.

In addition, as shown in FIG. 5, the connection mode judging unit 150may hold, in advance, a partner section communication time that isassumed when the relay apparatus 20 and the partner apparatus 30 areconnected through wired connection (assumed communication time). Then,the connection mode judging unit 150 may judge that the partner sectionis connected through wireless connection, when the partner sectioncommunication time calculated based on the first and the secondcommunication time falls outside the assumed communication time.

It is to be noted that the communication apparatus 10 does not recognizethe data transfer rate between the relay apparatus 20 and the partnerapparatus 30, and thus it is preferable that the communication apparatus10 hold a plurality of assumed communication time corresponding to aplurality of data transfer rates. In addition, although the datatransfer rate is more stable in wired communication than in the wirelesscommunication, an error may be included. Thus, it is preferable that theassumed communication time that the communication apparatus 10 holds isa certain time period that includes a logical assumed communicationtime.

FIG. 5 shows an example where the time required for transmitting andreceiving the measurement data and the response data (theoreticalvalues) are held as 1.64 (msec) and 164 (μsec), when it is assumed thatthe data transfer rate between the relay apparatus 20 and the partnerapparatus 30 is 100 Mbps or 1 Gbps. In addition, it is assumed that theerror is ±5% of the above described theoretical value.

Accordingly, the assumed communication time (1) is 1.56 (msec) to 1.72(msec), and the assumed communication time (2) is 156 (μsec) to 172(μsec). Then, the connection mode judging unit 150 may judge that thepartner section is wireless section, when an actually measured partnersection communication time does not fall within the range of the assumedcommunication time (1) or the assumed communication time (2) describedabove.

It is to be noted that the process in the above embodiment may beimplemented by a dedicated H/W (an integrated circuit or the like) andmay alternatively be implemented by causing a CPU to performinterpretive execution of predetermined program data with which theabove-described processing stored in the storage device (ROM, RAM, harddisk, etc.) can be executed.

Moreover, ways to achieve integration are not limited to the Large ScaleIntegration (LSI), and special circuit or general purpose processor canalso achieve the integration. It is also acceptable to use a FieldProgrammable Gate Array (FPGA) that is programmable after the LSI hasbeen manufactured, and a reconfigurable processor in which connectionsand settings of circuit cells within the LSI are reconfigurable.

In addition, the program data may be introduced into the storage deviceby way of a recording medium and may alternatively be directly executedfrom the recording medium. The recording medium represents: asemiconductor memory such as a ROM, a RAM, and a flash memory; amagnetic disk memory such as a flexible disk and a hard disk; an opticaldisc such as a CD-ROM, a DVD, and a BD; a memory card such as an SDcard; and the like. In addition, the recording medium includes, as aconcept, communication media such as a telephone line and a transmissionline.

While the embodiment of the present invention has been described abovewith reference to the drawings, the present invention is not limited tothe illustrated embodiments. Various modifications and variations may bemade to the illustrated embodiments within the literal or equivalentscope of the claimed invention.

INDUSTRIAL APPLICABILITY

The direct link communication control method according to the presentinvention measures, when a transmitting apparatus and a receivingapparatus are connected via a relay apparatus, a network status betweenthe transmitting apparatus and the receiving apparatus and a networkstatus between the transmitting apparatus and the relay apparatus. Thisproduces an advantageous effect of judging whether or not there is aplurality of wireless sections. The direct link communication controlmethod according to the present invention is useful for communicationbetween the transmitting apparatus and the receiving apparatus thatperform efficient data transmission through direct communication insteadof communication through wireless sections.

REFERENCE SIGNS LIST

1 Communication system

10 Communication apparatus

20 Relay apparatus

30 Partner apparatus

110, 210, 220, 310 Communication I/F

120 Measurement data transmitting unit

130 Response data receiving unit

140 Network measurement unit

150 Connection mode judging unit

160 Connection mode switching unit

230 Data relay unit

240, 320 Data transmitting and receiving unit

1. A communication apparatus which is connected through wirelessconnection to a relay apparatus that relays data, and communicates witha partner apparatus connected to the relay apparatus, said communicationapparatus comprising: a measurement data transmitting unit configured totransmit (i) first measurement data to the relay apparatus, and (ii)second measurement data to the partner apparatus via the relayapparatus, the first measurement data being data for measuring acommunication time between said communication apparatus and the relayapparatus, and the second measurement data being data for measuring acommunication time between said communication apparatus and the partnerapparatus via the relay apparatus; a response data receiving unitconfigured to (i) receive, from the relay apparatus, first response datathat is a response to the first measurement data, and (ii) receive, fromthe partner apparatus via the relay apparatus, second response data thatis a response to the second measurement data; a network measurement unitconfigured to (i) calculate, based on the first response data, a firstcommunication time that is a communication time between saidcommunication apparatus and the relay apparatus, and (ii) calculate,based on the second response data, a second communication time that is acommunication time between said communication apparatus and the partnerapparatus via the relay apparatus; a connection mode judging unitconfigured to judge whether or not the relay apparatus and the partnerapparatus are connected through wireless connection, based on a partnersection communication time that is a difference between the secondcommunication time and the first communication time; and a connectionmode switching unit configured to switch, when said connection modejudging unit judges that the relay apparatus and the partner apparatusare connected through wireless connection, the communication with thepartner apparatus from indirect wireless communication to directwireless communication, the indirect wireless communication beingwireless communication via the relay apparatus, and the direct wirelesscommunication being wireless communication not via the relay apparatus.2. The communication apparatus according to claim 1, wherein saidconnection mode judging unit is configured to judge that the relayapparatus and the partner apparatus are connected through wirelessconnection, when the partner section communication time is 50% or moreof the first communication time.
 3. The communication apparatusaccording to claim 1, wherein said connection mode judging unit isconfigured to (i) hold, in advance, an assumed communication time thatis a partner section communication time assumed when the relay apparatusand the partner apparatus are connected through wired connection, and(ii) judge that the relay apparatus and the partner apparatus areconnected through wireless connection, when the partner sectioncommunication time falls outside the assumed communication time.
 4. Thecommunication apparatus according to claim 1, wherein said measurementdata transmitting unit is configured to sequentially transmit (i) aplurality of measurement packets which are included in the firstmeasurement data, and (ii) a plurality of measurement packets which areincluded in the second measurement data, and said response datareceiving unit is configured to sequentially receive (i) a plurality ofresponse packets which are included in the first response data, and (ii)a plurality of response packets which are included in the secondresponse data.
 5. A communication system comprising: a relay apparatusthat relays data; a partner apparatus connected to said relay apparatus;and a communication apparatus that is connected through wirelessconnection to said relay apparatus and communicates with said partnerapparatus, wherein said communication apparatus includes: a measurementdata transmitting unit configured to transmit (i) a first measurementdata to said relay apparatus, and (ii) a second measurement data to saidpartner apparatus via said relay apparatus, the first measurement databeing data for measuring a communication time between said communicationapparatus and said relay apparatus, and the second measurement databeing data for measuring a communication time between said communicationapparatus and said partner apparatus via said relay apparatus; aresponse data receiving unit configured to (i) receive, from said relayapparatus, first response data that is a response to the firstmeasurement data, and (ii) receive, from said partner apparatus via saidrelay apparatus, second response data that is a response to the secondmeasurement data; a network measurement unit configured to (i)calculate, based on the first response data, a first communication timethat is a communication time between said communication apparatus andsaid relay apparatus, and (ii) calculate, based on the second responsedata, a second communication time that is a communication time betweensaid communication apparatus and said partner apparatus via said relayapparatus; a connection mode judging unit configured to judge whether ornot said relay apparatus and said partner apparatus are connectedthrough wireless connection, based on a partner section communicationtime that is a difference between the second communication time and thefirst communication time; and a connection mode switching unitconfigured to switch, when said connection mode judging unit judges thatsaid relay apparatus and said partner apparatus are connected throughwireless connection, the communication with said partner apparatus fromindirect wireless communication to direct wireless communication,indirect wireless communication being wireless communication via saidrelay apparatus, and the direct wireless communication being wirelesscommunication not via said relay apparatus, wherein said relay apparatusincludes: a data transmitting and receiving unit configured to generatethe first response data based on the first measurement data, and totransmit the generated first response data to said communicationapparatus; and a data relay unit configured to relay the secondmeasurement data received from said communication apparatus to saidpartner apparatus, and to relay the second response data received fromsaid partner apparatus to said communication apparatus, wherein saidpartner apparatus includes a data transmitting and receiving unitconfigured to generate the second response data based on the secondmeasurement data, and to transmit the generated second response data tosaid communication apparatus via the relay apparatus, the secondmeasurement data being received from said partner apparatus via therelay apparatus.
 6. A communication method for causing a communicationapparatus to switch between connection modes for communication with apartner apparatus, the communication apparatus being connected throughwireless connection to a relay apparatus that relays data andcommunicating with the partner apparatus that is connected to the relayapparatus, said communication method comprising: transmitting (i) firstmeasurement data to the relay apparatus, and (ii) second measurementdata to the partner apparatus via the relay apparatus, the firstmeasurement data being data for measuring a communication time betweenthe communication apparatus and the relay apparatus, and the secondmeasurement data being data for measuring a communication time betweenthe communication apparatus and the partner apparatus via the relayapparatus; (i) receiving, from the relay apparatus, first response datathat is a response to the first measurement data, and (ii) receiving,from the partner apparatus via the relay apparatus, second response datathat is a response to the second measurement data; calculating (i) afirst communication time based on the first response data, and (ii) asecond communication time based on the second response data, the firstcommunication time being a communication time between the communicationapparatus and the relay apparatus, and the second communication timebeing a communication time between the communication apparatus and thepartner apparatus via the relay apparatus; judging whether or not therelay apparatus and the partner apparatus are connected through wirelessconnection, based on a partner section communication time that is adifference between the second communication time and the firstcommunication time; and switching, when it is judged in said judgingthat the relay apparatus and the partner apparatus are connected throughwireless connection, the communication with the partner apparatus fromindirect wireless communication to direct wireless communication, theindirect wireless communication being wireless communication via therelay apparatus, and the direct wireless communication being wirelesscommunication not via the relay apparatus.
 7. A program for causing acommunication apparatus to switch between connection modes forcommunication with a partner apparatus, the communication apparatusbeing connected through wireless connection to a relay apparatus thatrelays data and communicating with the partner apparatus that isconnected to the relay apparatus, said program causing the communicationapparatus to execute: transmitting (i) a first measurement data to therelay apparatus, and (ii) a second measurement data to the partnerapparatus via the relay apparatus, the first measurement data being datafor measuring a communication time between the communication apparatusand the relay apparatus, and the second measurement data being data formeasuring a communication time between the communication apparatus andthe partner apparatus via the relay apparatus; (i) receiving, from therelay apparatus, first response data that is a response to the firstmeasurement data, and (ii) receiving, from the partner apparatus via therelay apparatus, second response data that is a response to the secondmeasurement data; calculating (i) a first communication time based onthe first response data, and (ii) a second communication time based onthe second response data, the first communication time being acommunication time between the communication apparatus and the relayapparatus, and the second communication time being a communication timebetween the communication apparatus and the partner apparatus via therelay apparatus; judging whether or not the relay apparatus and thepartner apparatus are connected through wireless connection, based on apartner section communication time that is a difference between thesecond communication time and the first communication time; andswitching, when it is judged in said judging that the relay apparatusand the partner apparatus are connected through wireless connection, thecommunication with the partner apparatus from indirect wirelesscommunication to direct wireless communication, the indirect wirelesscommunication being wireless communication via the relay apparatus, andthe direct wireless communication being wireless communication not viathe relay apparatus.
 8. An integrated circuit for causing acommunication apparatus to switch between connection modes forcommunication with a partner apparatus, the communication apparatusbeing connected through wireless connection to a relay apparatus thatrelays data and communicating with the partner apparatus that isconnected to the relay apparatus, said integrated circuit comprising: ameasurement data transmitting unit configured to transmit (i) a firstmeasurement data to the relay apparatus, and (ii) a second measurementdata to the partner apparatus via the relay apparatus, the firstmeasurement data being data for measuring a communication time betweensaid communication apparatus and the relay apparatus, and the secondmeasurement data being data for measuring a communication time betweensaid communication apparatus and the partner apparatus via the relayapparatus; a response data receiving unit configured to (i) receive,from the relay apparatus, first response data that is a response to thefirst measurement data, and (ii) receive, from the partner apparatus viathe relay apparatus, second response data that is a response to thesecond measurement data; a network measurement unit configured to (i)calculate, based on the first response data, a first communication timethat is a communication time between said communication apparatus andthe relay apparatus, and (ii) calculate, based on the second responsedata, a second communication time that is a communication time betweensaid communication apparatus and the partner apparatus via the relayapparatus; a connection mode judging unit configured to judge whether ornot the relay apparatus and the partner apparatus are connected throughwireless connection, based on a partner section communication time thatis a difference between the second communication time and the firstcommunication time; and a connection mode switching unit configured toswitch, when said connection mode judging unit judges that the relayapparatus and the partner apparatus are connected through wirelessconnection, the communication with the partner apparatus from indirectwireless communication to direct wireless communication, the indirectwireless communication being wireless communication via the relayapparatus, and the direct wireless communication being wirelesscommunication not via the relay apparatus.